﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Net;

namespace PFAGame.NetworkingGame
{
    class LootNet
    {
        #region Fields

        public int Id
        {
            get;
            private set;
        }

        public AObject.e_object TypeLoot
        {
            get;
            private set;
        }

        public Vector2 Position
        {
            get;
            private set;
        }

        #endregion

        public LootNet(PacketReader packetReader)
        {
            if (packetReader == null)
                throw new ArgumentNullException("packetReader");

            this.Id = packetReader.ReadInt32();
            this.TypeLoot = (ALoot.e_object) packetReader.ReadInt32();
            this.Position = packetReader.ReadVector2();
        }

        internal static void Serialize(ALoot loot, PacketWriter packetWriter)
        {
            if (packetWriter == null)
                throw new ArgumentNullException("packetWriter");

            packetWriter.Write(loot.Id);
            packetWriter.Write((int) loot.obj);
            packetWriter.Write(loot.Position);
        }
    }
}
